package org.jackysoft.interceptor;

import java.lang.reflect.Method;

import org.jackysoft.entity.Identifiable;

import com.opensymphony.xwork2.ActionInvocation;

public class CreateInterceptor extends AbstractInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3992627847448969832L;

	@Override
	public String intercept(ActionInvocation invokor) throws Exception {
		String rst = super.intercept(invokor);
		if(VALIDATED.equals(rst)){
			return VALIDATED;
		}
		// 获得这个action中所对应的class类型参数
		
	
		Method createBean = service.getClass().getMethod(SERVICE_INSERT_BEAN_,Identifiable.class);
		// 调用service的插入bean方法
		
		
		createBean.invoke(service, bean);		
		
		return invokor.invoke();
	}

}
